/* 
 * File:   StorageMock.h
 * Author: alexey
 *
 * Created on 31 Март 2011 г., 18:21
 */

#ifndef STORAGEMOCK_H
#define	STORAGEMOCK_H
#include <gmock/gmock.h>
#include <IDirectory.h>
#include <IStorage.h>
#include <IServiceLocator.h>
#include "../md5/md5.h"

namespace mock
{
    using ::testing::_;
    using ::testing::Return;
    class StorageObjectMock : public storagemon::IStorage
    {
    public:
        StorageObjectMock()
        {
            ON_CALL(*this, id())
                .WillByDefault(Return(0));

            ON_CALL(*this, name())
                .WillByDefault(Return(""));

            ON_CALL(*this, path())
                .WillByDefault(Return(""));

            ON_CALL(*this, add_dir( _ ))
                .WillByDefault(Return(false));

            ON_CALL(*this, remove_dir( _ ))
                .WillByDefault(Return(false));

            ON_CALL(*this, size())
                .WillByDefault(Return(0));

        }
        virtual ~StorageObjectMock() {};
        MOCK_CONST_METHOD0(id, u_long ());
        MOCK_CONST_METHOD0(name, const char* ());
        MOCK_CONST_METHOD0(path, const char* ());
        MOCK_METHOD1(add_dir, bool (storagemon::IDirectory* file));
        MOCK_METHOD1(remove_dir, bool (u_long id));
        MOCK_CONST_METHOD0(size, u_long ());
        MOCK_METHOD1(get_dir, std::vector<storagemon::IDirectory*>::iterator (u_long id));
    };

    inline storagemon::IService* CreateStorageServiceMock(const char* name,
            const char* path, u_long id, u_long parent_id,
            char md5[MD5_DIGEST_SIZE])
    {
        return new StorageObjectMock();
    }
} //mock

#endif	/* STORAGEMOCK_H */

